package com.mojo.kafka.interceptor;

import org.apache.kafka.clients.producer.ProducerInterceptor;
import org.apache.kafka.clients.producer.ProducerRecord;
import org.apache.kafka.clients.producer.RecordMetadata;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Map;

/**
 * 自定义生产者拦截器
 *
 * @author <a href="mailto:mojo_jj@163.com">Mojo</a>
 */
public class MyProducerInterceptor implements ProducerInterceptor {
    private static final Logger logger = LoggerFactory.getLogger(MyProducerInterceptor.class);
    @Override
    public ProducerRecord onSend(ProducerRecord record) {
        logger.info("MyProducerInterceptor:{}","生产者拦截器");
        return record;
    }

    @Override
    public void onAcknowledgement(RecordMetadata metadata, Exception exception) {

    }

    @Override
    public void close() {

    }

    @Override
    public void configure(Map<String, ?> configs) {

    }
}
